/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.benimetum.test;

import com.benimetum.database.Sparql;
import com.benimetum.items.Person;
import com.benimetum.managers.AnnouncementManager;
import com.benimetum.managers.CommunityManager;
import com.benimetum.managers.TeacherManager;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.ResultSetFormatter;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author sony
 */
public class testAnıl {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
//        try {
//                  
                   String communityId = "co985740834";
//                    CommunityManager.addMember(communityId, "st083201040");
//                    
//                    String query="select ?id where{?comm rdf:type etu:Community. ?comm etu:id \""+communityId+"\". ?comm etu:hasMembers ?person. ?person etu:id ?id}";
//                    String query="select ?id where{?comm rdf:type etu:Community. ?comm etu:id \""+communityId+"\". ?comm etu:hasMembers ?person. ?person etu:id ?id}";
//                    ResultSet rs=Sparql.search(query);
//                     ResultSetFormatter.out(System.out,rs);
//                      
//                      String query="select ?id ?text ?teacherId where{?ann rdf:type etu:Announcement. ?ann etu:ownedBy ?comm. ?comm etu:id \""+communityId+"\". "
//                                + "?ann etu:id ?id. ?ann etu:text ?text. ?ann etu:addedby ?teacher. ?teacher etu:id ?teacherId.}";
//        
//                   Calendar calendar = Calendar.getInstance();
//                   SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
// 
//                   
//                   
//                   
//                   PrintWriter outputStream;
//        try {
//            outputStream = new PrintWriter(new FileOutputStream("description.txt", true));
//            outputStream.println("co123456"+"="+dateFormat.format(calendar.getTime()) );
//            outputStream.close();
//        } catch (FileNotFoundException ex) {
//            Logger.getLogger(testAnıl.class.getName()).log(Level.SEVERE, null, ex);
//        }
//                    
//                    
//                    
                   
//
//
//                    
//        } catch (FileNotFoundException ex) {
//            Logger.getLogger(testAnıl.class.getName()).log(Level.SEVERE, null, ex);
//        }
              
         String query="select ?id where{?comm rdf:type etu:Community. ?comm etu:id \""+communityId+"\". ?comm etu:hasMembers ?person. ?person etu:id ?id}";
         ResultSet rs=Sparql.search(query);
         ResultSetFormatter.out(System.out,rs);
  
         
        
    
    }
}
